<?php
/**
 * Created by PhpStorm.
 * User: rocky
 * Date: 2019-07-14
 * Time: 01:24
 */

namespace app\shop\resource;

use app\common\model\ShopMemberIdentity;
use app\common\model\ShopStudyCate;
use app\common\resource\BaseResource;

class UserResoure extends BaseResource
{
    public function toArray($data)
    {
        $grabe_name = ShopStudyCate::where('id',$data['grade_id'])->field('title')->find();
        $identity_name = ShopMemberIdentity::where('id',$data['identity_id'])->field('identity_name')->find();
        return [
            'id' => $data['id'],
            'headimg' => $data['headimg'],
            'nickname' => $data['nickname'],
            'name' => $data['name'],
            'money' => $data['money'],
            'birthday' => $data['birthday'],
            'gender' => $data['gender'],
            'level' => $data['level'],
            'lid' => $data['lid'],
            'is_vipCard' => $data['is_vipCard'],
            'expire_time' => $data['expire_time'],
            'residue_num' => $data['residue_num'],
            'mobile' => $data['phone'],
            'home_address' => $data['home_address'],
            'user_class' => $data['user_class'],
            'grade_id' => $data['grade_id'],
            'grabe_name' => $grabe_name['title'],
            'identity_name' => $identity_name['identity_name'],
            'identity_id' => $data['identity_id'],
            'identity_name' => $identity_name['identity_name'],
        ];
    }

}